import Mock from 'mockjs';

// 模拟接口返回的用户数据
Mock.mock('/api/login', 'post', (options) => {
  const body = JSON.parse(options.body); // 解析请求体参数
    if (body.uid == 'admin') {
      return {
        "status": 200,
        message: '登陆成功',
        "data": {
          "uid": "admin",
          "name": "管理员",
          "password": '123',
          url: '../../orderPages/index/index'
        },
      }
    }
    
    return {
      "status": 200,
       message: '登陆成功',
        "data": {
          "name": "John Doe",
          "age": 30,
          "address": "New York, USA"
        }
      }
});

// 模拟接口返回的产品列表数据
Mock.mock('/api/products?', 'get', {
  "status": 200,
  "data": [
    { "id": 1, "name": "Product 1", "price": 100 },
    { "id": 2, "name": "Product 2", "price": 200 },
    { "id": 3, "name": "Product 3", "price": 300 }
  ]
});
